package com.csy.property.controller.community;

import com.csy.commons.core.controller.BaseController;
import com.csy.commons.core.domain.BaseResponse;
import com.csy.commons.core.page.PageResult;
import com.csy.property.community.domain.AjCommunityInteraction;
import com.csy.property.community.service.AjCommunityInteractionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/system/interaction")
public class AjCommunityInteractionController extends BaseController {

    @Resource
    private AjCommunityInteractionService ajCommunityInteractionService;

    /**
     * 互动列表
     * @param ajCommunityInteraction
     * @return
     */
    @GetMapping("/list")
    private PageResult list(AjCommunityInteraction ajCommunityInteraction){
        startPage();
        List<AjCommunityInteraction> ajComplaintSuggests = ajCommunityInteractionService.selectCommunityInteractionList(ajCommunityInteraction);
        return getData(ajComplaintSuggests);
    }

    /**
     * 新增
     * @param ajCommunityInteraction
     * @return
     */
    @PostMapping
    private BaseResponse add(@RequestBody AjCommunityInteraction ajCommunityInteraction){
        int row = ajCommunityInteractionService.add(ajCommunityInteraction);
        return toAjax(row);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    private BaseResponse del(@PathVariable("id")String id){
        int row = ajCommunityInteractionService.deleteById(id);
        return toAjax(row);
    }







}
